<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <p>侦听器的应用场景：数据变化时执行异步或开销比较大的操作</p>
        <input type="text" name="" id="" v-model='firstName'>
        <input type="text" name="" id="" v-model='lastName'>
        <input type="text" name="" id="" v-model='fullName'>
    </div>
</body>
<script src="js/vue.js"></script>
<script>

    var vm = new Vue({
        el:'#app',
        data:{
            msg:'orange',
            num:100,
            firstName:'hh',
            lastName:'jack',
            fullName:'hh jack'
        },
        methods: {
            reverseStringCom:function(){
                console.log('放入函数中')
                return this.msg.split('').reverse().join('')
            }
        },
        watch: {
            lastName:function(val){
                this.fullName = val +'  '+this.firstName
            },
            firstName:function(val){
                this.fullName = this.lastName + '  '+ val
            }

        },
    })

</script>
</html>